Is it possible to associate a workflow action with a workflow state so that it is executed when content reaches this state rather than associating the action with a workflow command which requires manual transition?
This task can be solved by attaching an Item which will invoke the action to the workflow state. This Item should be based on either the Action or Command template.
The following article describes how to attach an action to the workflow command.
http://sdn.sitecore.net/FAQ/API/Cause%20the%20workflow%20to%20invoke%20an%20action.html
The task stated in the present article requires that the action is attached to a workflow state:
See the description of the two approaches below:
The difference is that when you use the Command template, the method that will be invoked should be specified. In case the Action template is used, the method named Process will be invoked by default, but with this template you can also pass some Parameters with the method arguments. Below is a sample snippet of the CustomWorkflowActions.LogAction class:
namespace CustomWorkflowActions
{
public class LogAction
{
public void Process(WorkflowPipelineArgs args)
{
Sitecore.Diagnostics.Log.Info("ALERT!" + args.DataItem, this);
}
}
}